<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>管理员-教师管理</title>
    <jsp:include page="header.jsp"></jsp:include>
    <style type="text/css">
        .table th, .table td {
            text-align: center; /** 设置水平方向居中 */
            vertical-align: middle /** 设置垂直方向居中 */
        }
    </style>
</head>
<body>
<div class="container">
    <h3>教师信息列表</h3>
    <div style="float: left;margin: 5px">
        <a class="btn btn-default" href="home.jsp">返回</a>
    </div>
    <div style="float: left;margin: 5px">
        <a class="btn btn-default" href="${pageContext.request.contextPath}/admin/queryAllTeacherServlet">刷新</a>
    </div>
    <div style="float: right;margin: 5px">
        <a class="btn btn-primary" href="addTeacher.jsp">添加教师</a>
    </div>
    <h4 id="msg" class="text-danger text-center">${requestScope.msg}</h4>
    <table class="table table-bordered table-hover table-responsive text-center">
        <tr class="success">
            <th>编号</th>
            <th>教工号</th>
            <th>姓名</th>
            <th>院系</th>
            <th>激活</th>
            <th>修改密码</th>
            <th>删除教师</th>
        </tr>
        <c:forEach items="${requestScope.allTeachers}" var="teacher" varStatus="s">
            <tr>
                <td>${s.count}</td>
                <td>${teacher.tid}</td>
                <td>${teacher.tname}</td>
                <td>${teacher.department}</td>
                <td>
                    <c:if test="${teacher.activation}">是</c:if>
                    <c:if test="${!teacher.activation}">否</c:if>
                </td>
                <td>
                    <form class="form-inline"
                          action="${pageContext.request.contextPath}/admin/changeTeacherPasswordServlet">
                        <div class="form-group">
                            <input type="hidden" name="tid" value="${teacher.tid}">
                            <label for="exampleInputName2">新的密码</label>
                            <input type="text" class="form-control" id="exampleInputName2" name="newPassword"
                                   maxlength="16">
                        </div>
                        <button type="submit" class="btn btn-default">修改密码</button>
                    </form>
                </td>
                <td>
                    <form action="${pageContext.request.contextPath}/admin/queryAllTeacherServlet" method="post">
                        <input type="hidden" name="tid" value="${teacher.tid}">
                        <input class="btn btn-danger" type="submit" value="删除">
                    </form>
                </td>
            </tr>
        </c:forEach>
    </table>
    <%--        <div>--%>
    <%--            <nav aria-label="Page navigation">--%>
    <%--                <ul class="pagination">--%>
    <%--                    <li>--%>
    <%--                        <a href="#" aria-label="Previous">--%>
    <%--                            <span aria-hidden="true">&laquo;</span>--%>
    <%--                        </a>--%>
    <%--                    </li>--%>
    <%--                    <li><a href="#">1</a></li>--%>
    <%--                    <li><a href="#">2</a></li>--%>
    <%--                    <li><a href="#">3</a></li>--%>
    <%--                    <li><a href="#">4</a></li>--%>
    <%--                    <li><a href="#">5</a></li>--%>
    <%--                    <li>--%>
    <%--                        <a href="#" aria-label="Next">--%>
    <%--                            <span aria-hidden="true">&raquo;</span>--%>
    <%--                        </a>--%>
    <%--                    </li>--%>
    <%--                    <span style="font-size: 25px;margin-left: 5px">--%>
    <%--                        共16条记录，共4页--%>
    <%--                    </span>--%>
    <%--                </ul>--%>
    <%--            </nav>--%>
    <%--        </div>--%>
</div>
<jsp:include page="../footer.jsp"></jsp:include>
</body>
</html>
